// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vuex from 'Vuex'
import store from '../static/utils/store'
import axios from 'axios'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import animate from 'animate.css'
import locallstorage from '../static/utils/uitls'
Vue.use(ElementUI)
Vue.use(Vuex)
Vue.use(animate)
Vue.use(locallstorage)
Vue.prototype.$axios = axios
export default store
router.beforeEach((to, from, next) => {
  if (to.matched.some(record => record.meta.auth)) {
    if (store.state.isLogin== 5) {
      next()
    } else {
      next({ path: '/sign'})
    }
  } else {
    next()
  }
})
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
